/**
 * 所有接口集合
 */
import { myRequest } from "./request.js"
import baseUrl from './baseUrl.js'

export default {
	// 用户登陆
	userLogin: params => {
		return myRequest({
			author: true,
			method: 'POST',
			url: '/api/user/login?servicekey=User',
			data: params
		});
	},
	
	// 获取用户信息
	getUserInfo: params => {
		return myRequest({
			url: '/api/user/getcurrentuserinfo?servicekey=User',
			data: params
		})
	},
	
	// 获取验证码
	getIdentifyCode: params => {
		return myRequest({
			url: '/api/fasg/Register/GetIdentifyCode?servicekey=Register',
			method: 'POST',
			data: params
		})
	},
	
	// 校验验证码
	validateIdentifyCode: params => {
		return myRequest({
			url: '/api/fasg/Register/ValidateIdentifyCode?servicekey=Register',
			data: params
		})
	},
	
	// 查询用户是否有权限进入手机端
	getUserFuncLimit: params => {
		return myRequest({
			url: '/api/user/GetUserCurrentFuncLimit?servicekey=User',
			data: params
		})
	},
	
	// 完善注册信息
	createFasgUser: params => {
		return myRequest({
			url: '/api/fasg/Register/CreateFasgUser?servicekey=Register',
			data: params
		})
	},
	
	// 修改密码
	resetPassword: params => {
		return myRequest({
			url: '/api/user/updatepassword?servicekey=User',
			data: params
		})
	},
	
	// 获取资产列表
	getAssetList: params => {
		return myRequest({
			url: '/api/fasg/Asset/GetListByPage?servicekey=Asset',
			method: 'POST',
			data: params
		});
	},

	// 筛选-获取房产列表
	getOrgList: params => {
		return myRequest({
			url: '/api/basedata/Org/GetList?servicekey=Org',
			method: 'POST',
			data: params || {"OrgCode": "", "OrgName": ""}
		});
	},
	
	// 筛选-获取类型、状态
	getTypeStatusList: params => {
		return myRequest({
			url: '/api/basedata/dict/getKeyList?servicekey=Dict',
			method: 'POST',
			data: params
		});
	},
	
	// 获取资产详情
	getAssetDetail: params => {
		return myRequest({
			url: '/api/fasg/Asset/Get?servicekey=Asset',
			method: 'POST',
			data: params
		});
	},
	
	// 获取日志列表
	getListLog: params => {
		return myRequest({
			url: '/api/fasg/changelog/GetListLog',
			method: 'POST',
			data: params
		});
	},
	
	// 获取编辑日志
	getEditLogDetail: params => {
		return myRequest({
			url: '/api/fasg/changelog/GetEditLogDetail',
			method: 'POST',
			data: params
		});
	},
	
	// 编辑资产
	upDateAsset: params => {
		return myRequest({
			url: '/api/fasg/asset/update?servicekey=Asset',
			method: 'POST',
			data: params
		});
	},

	// 获取资产处置详情
	getHandleDetail: params => {
		return myRequest({
			url: '/api/fasg/assethandle/gethandledetail?servicekey=AssetHandle',
			method: 'POST',
			data: params
		});
	},
	
	// 取消转移
	cancelTransfer: params => {
		return myRequest({
			url: '/api/fasg/assethandle/canceltransfer?servicekey=AssetHandle',
			method: 'POST',
			data: params
		});
	},

	// 申请资产处置
	handleCreate: params => {
		return myRequest({
			url: '/api/fasg/assethandle/create?servicekey=AssetHandle',
			method: 'POST',
			data: params || {
				"Describe": "",
				"OrgGuid": "",
				"TargetOrgGuid": "",
				"HandleType": "",
				"AssetGuids": []
			}
		});
	},
	// 申请资产处置
	quickhandle: params => {
		return myRequest({
			url: '/api/fasg/assethandle/quickhandle?servicekey=AssetHandle',
			method: 'POST',
			data: params || {
				"Describe": "",
				"OrgGuid": "",
				"TargetOrgGuid": "",
				"HandleType": "",
				"AssetGuids": []
			}
		});
	},
	// 文件上传
	uploadFile: filePath => {
		return new Promise((resolve, reject) => {
			uni.uploadFile({
				filePath,
				name: "file",
				method: "POST",
				header: {
					"Authorization": uni.getStorageSync('TOKEN')
				},
				url: // #ifndef H5
					baseUrl +
					// #endif
				"/api/fasg/FileUpload/Upload",
				success: res => resolve(res.data),
				fail: err => {
					uni.showModal({
						content: JSON.stringify(err)
					});
				}
			});
		});
	},
	
	// 获取历史盘点报告列表
	getCheckHistoryList: params => {
		return myRequest({
			url: "/api/fasg/Check/GetTaskList?servicekey=Check",
			method: "POST",
			data: params
		});
	},
	
	// 获取盘点记录详情
	getCheckTaskDetail: data => {
		return myRequest({
			url: "/api/fasg/Check/getTaskReport?servicekey=Check",
			method: "POST",
			data
		});
	},
	
	// 资产盘点-获取二级类型数据
	getSubType: params => {
		return myRequest({
			url: "/api/fasg/check/getchildreport?servicekey=Check",
			method: "POST",
			data: params
		})
	},
	
	// 资产盘点-获取盘点列表
	getCheckList: params => {
		return myRequest({
			url: "/api/fasg/check/getchecklist?servicekey=Check",
			method: "POST",
			data: params
		})
	},
	
	// 获取当前用户权限
	getUserCurrentDataFunc: params => {
		return myRequest({
			url: "/api/user/getusercurrentdatafunc",
			method: "POST",
			data: params
		})
	},
	
	// 获取审核列表数据
	getExamineList: params => {
		return myRequest({
			url: "/api/fasg/assethandle/getlistbypage?servicekey=AssetHandle",
			method: "POST",
			data: params
		})
	},
	
	// 获取处置类型
	getExamineType: params => {
		return myRequest({
			url: "/api/basedata/dict/getlist",
			method: "POST",
			data: params
		})
	},
	
	// 处置-通过审核
	approvedHandle: params => {
		return myRequest({
			url: "/api/fasg/assethandle/approvedhandle?servicekey=AssetHandle",
			method: "POST",
			data: params
		})
	},
	
	// 处置-驳回
	refuseHandle: params => {
		return myRequest({
			url: "/api/fasg/assethandle/refusehandle?servicekey=AssetHandle",
			method: "POST",
			data: params
		})
	},
		// 资产转移
	transferasset: params => {
		return myRequest({
			url: "/api/fasg/assethandle/transferasset?servicekey=AssetHandle",
			method: "POST",
			data: params
		})
	},
	
	// 报警列表
	getAlarmList: params => {
		return myRequest({
			url: "/api/fasg/alarm/GetListByPage?servicekey=Alarm",
			method: "POST",
			data: params
		});
	},
	
	// 报警详情
	getAlarmDetail: params => {
		return myRequest({
			url: "/api/fasg/alarm/GetAlarmDetail?servicekey=Alarm",
			method: "POST",
			data: params
		});
	},
	
	// 忽略报警
	ignoreAlarm: params => {
		return myRequest({
			url: "/api/fasg/alarm/IgnoreAlarm?servicekey=Alarm",
			method: "POST",
			data: params
		});
	},
	
	// 获取处理信息
	getAlarmHandleInfo: params => {
		return myRequest({
			url: "/api/fasg/AssetHandle/GetHandleDetail?servicekey=AssetHandle",
			method: "POST",
			data: params
		});
	},
	// 获取手持机默认房产信息
	getReaderInfo: params => {
		return myRequest({
			url: "/api/fasg/AssetHandle/getreaderinfo?servicekey=AssetHandle",
			method: "POST",
			data: params
		});
	},
	
	// 获取当前用户ID
	getCurrentuserinfo: params => {
		return myRequest({
			url: "/api/user/getcurrentuserinfo",
			method: "POST",
			data: params
		});
	},
	
	
	// 字典接口（操作记录列表页面使用）
	getDictList: params => {
		return myRequest({
			url: "/api/baseData/Dict/getList",
			method: "POST",
			data: params
		});
	},
	
	//根据资产ID获取操作记录列表
	getOperationListByAssetID: params => {
		return myRequest({
			url: "/api/fasg/assetoperationlog/getallbyassetguid",
			method: "POST",
			data: params,
		})
	},
	
	// 获取操作记录列表
	getOperationList: params => {
		return myRequest({
			url: "/api/fasg/AssetOperationLog/GetListByPage?servicekey=AssetOperationLog",
			method: "POST",
			data: params
		})
	},
	
	// 获取操作记录详情
	getOperationDetail: params => {
		return myRequest({
			url: "/api/fasg/AssetOperationLog/Get?servicekey=AssetOperationLog",
			method: "POST",
			data: params
		});
	},
	
	// 统计当前用户资产
	getUserAssetsInfo: () => {
		return myRequest({
			url: "/api/fasg/asset/statisticmyselfassetoverview?servicekey=Asset"
		});
	},
	
	// 统计当前用户资产安全状况
	getUserAssetsAlarmInfo: () => {
		return myRequest({
			url: "/api/fasg/alarm/statisticmyselfassetsecurityleveldata?servicekey=Alarm"
		});
	},
	
	// 获取当前用户最后一次盘点报告
	getUserLastReport: () => {
		return myRequest({
			url: "/api/fasg/Check/GetMySelfLastCheckReport?servicekey=Check"
		});
	},
	
	
	// 盘点报告设置已读
	readReport: params => {
		return myRequest({
			url: "/api/fasg/Notification/UpdateReadState?servicekey=Notification",
			method: "POST",
			data: params
		});
	},
  //获取站内消息
	getNotificationList: params => {
		return myRequest({
			url: "/api/Fasg/Notification/GetList?servicekey=Notification",
			method: "POST",
			data: params
		});
	},
	
	//分页获取站内消息
	getNotificationListByPage: params => {
		return myRequest({
			url: "/api/Fasg/Notification/GetListByPage?servicekey=Notification",
			method: "POST",
			data: params
		});
	},
	
	//获取未读站内消息数量
	getUnReadStatistics: params => {
		return myRequest({
			url: "/api/Fasg/Notification/GetUnReadStatistics?servicekey=Notification",
			method: "POST",
			data: params
		});
	},
	
	//设置未读站内消息状态
	setUpdateReadState: params => {
		return myRequest({
			url: "/api/fasg/Notification/UpdateReadState?servicekey=Notification",
			method: "POST",
			data: params
		});
	},
	//清除未读信息
	setAllNotificationRead: params => {
		return myRequest({
			url: '/api/Fasg/Notification/SetAllNotificationRead?servicekey=Notification',
			data: params
		})
	},
	// 获取报警处理详情
	getAlarmHandleDetail: params => {
		return myRequest({
			url: "/api/fasg/alarm/getalarmhandle?servicekey=Alarm",
			data: params,
			method: "POST"
		});
	}
}
